<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/commons/global.jsp" %>
<script type="text/javascript">

    $(function() {

        $('#menurespid').combotree({
            url : '${path }/menures/menuListDto',
            idField : 'id',
            treeField : 'text',
            parentField : 'pid',
            value:${menu.menurespid},
            onChange: function (newValue, oldValue) {
                $('#psn').textbox('setValue',oldValue);
                $.ajax({
                    url: '${path }/menures/getPsn?id=' + newValue,//传参数到一般处理方法，并赋值
                    type:"Get",
                    success: function (data) {//ajax请求完成时执行，data为返回的结果
                        $('#psn').textbox('clear');
                        $('#psn').textbox('setValue',data);

                    }
                });
            }

        });

        $('#menuEditForm').form({
            url : '${path }/menures/edit',
            onSubmit : function() {
                progressLoad();
                var isValid = $(this).form('validate');
                if (!isValid) {
                    progressClose();
                }
                return isValid;
            },
            success : function(result) {
                progressClose();
                result = $.parseJSON(result);
                if (result.success) {
                    <%--var urls= '${path }/menures/menuList';--%>
                   <%----%>
                    <%--parent.$.modalDialog.openner_dataGrid.treegrid('load',urls);//之所以能在这里调用到parent.$.modalDialog.openner_dataGrid这个对象，是因为user.jsp页面预定义好了--%>
                    parent.$.modalDialog.openner_dataGrid.treegrid('reload');
                    parent.$.modalDialog.handler.dialog('close');
                } else {
                    parent.$.messager.alert('错误', result.msg, 'error');
                }
            }
        });

    });
</script>
<div class="easyui-layout" data-options="fit:true,border:false">
    <div data-options="region:'center',border:false" title="" style="overflow: hidden;padding: 3px;">
        <form id="menuEditForm" method="post">

            <table class="grid">
                <tr>
                    <td>菜单名</td>
                    <td><input name="id" type="hidden" value="${menu.id}">
                        <input name="name" type="text" placeholder="请输入菜单名称" class="easyui-validatebox" data-options="required:true" value="${menu.name}" ></td>
                </tr>
                <tr>
                    <td>菜单位置</td>
                    <td><select id="menupos" name="menupos" class="easyui-combobox" data-options="width:140,height:29,editable:false,panelHeight:'auto'" value="${menu.menurespid}">
                        <option value="0">顶部菜单</option>
                        <option value="1">系统菜单</option>
                        <option value="2">左边菜单</option>
                        <option value="3">操作菜单</option>
                    </select></td>
                </tr>

                <tr>
                    <td>菜单链接</td>
                    <td><input  id="href" name="href" style="width: 140px; height: 29px;" class="easyui-textbox" value="${menu.href}"  /></td>
                </tr>
                <tr>
                    <td>菜单图标</td>
                    <td><input  id="icon" name="icon" style="width: 140px; height: 29px;" class="easyui-textbox" value="${menu.icon}" /></td>
                </tr>
                <tr>
                    <td>排序码</td>
                    <td><input class="easyui-numberspinner" name="ordernum" value="${menu.ordernum}"/></td>
                </tr>
                <tr>
                    <td>父类菜单</td>
                    <td><select id="menurespid" name="menurespid" style="width: 140px; height: 29px;" class="easyui-validatebox" data-options="required:true" ></select></td>
                </tr>
                <tr>
                    <td>分类管理码'</td>
                    <td><input type="text" name="psn" id="psn" value="${menu.psn}" class="easyui-textbox" /></td>
                </tr>
                <tr>
                    <td>权限位</td>
                    <td><input type="text" name="postbit" id="postbit" value="${menu.postbit}" class="easyui-textbox"  /></td>
                </tr>
            </table>
        </form>
    </div>
</div>